package com.hd.tiyu.yuejian.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.TextView;

import com.hd.tiyu.yuejian.Adapter.DashiketangAdapter;
import com.hd.tiyu.yuejian.JavaBean.Actcate;
import com.hd.tiyu.yuejian.JavaBean.Activity;
import com.hd.tiyu.yuejian.JavaBean.Dashi;
import com.hd.tiyu.yuejian.JavaBean.ShaituDetail;
import com.hd.tiyu.yuejian.Model.ListsModel;
import com.hd.tiyu.yuejian.R;
import com.squareup.picasso.Picasso;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by admin on 2017/10/24.
 */

public class ShaituDetailActivity extends AppCompatActivity {
    private ShaituDetail data;

    private TextView title;

    private ImageView thumb0,thumb1,thumb2;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shaitudetail);
        initView();
        initEvent();
        initData();
    }

    private void initData() {
        Intent intent=getIntent();
        String id=intent.getStringExtra("id");
        ListsModel listsmodel=new ListsModel();
        Call<List<ShaituDetail>> call=listsmodel.getShaireply(id);
        call.enqueue(new Callback<List<ShaituDetail>>() {
            @Override
            public void onResponse(Call<List<ShaituDetail>> call,Response<List<ShaituDetail>> response) {
                List<ShaituDetail> list=response.body();
                data=list.get(0);
                title.setText(data.getTitle());
                Picasso.with(ShaituDetailActivity.this).load("http://172.24.10.175/workout/Uploads/"+data.getThumb0()).into(thumb0);
                Picasso.with(ShaituDetailActivity.this).load("http://172.24.10.175/workout/Uploads/"+data.getThumb1()).into(thumb1);
                Picasso.with(ShaituDetailActivity.this).load("http://172.24.10.175/workout/Uploads/"+data.getThumb2()).into(thumb2);
            }
            @Override
            public void onFailure(Call<List<ShaituDetail>> call,Throwable t) {

            }
        });



    }
    private void initEvent() {

    }

    private void initView() {
        title=(TextView)findViewById(R.id.dashidetail_name);
        thumb0=(ImageView)findViewById(R.id.dashidetail_img1);
        thumb1=(ImageView)findViewById(R.id.dashidetail_img2);
        thumb2=(ImageView)findViewById(R.id.dashidetail_img3);
    }
}
